package jmine.tec.aom.services.include;

import jmine.tec.aom.dao.PropertyTypeDAO;
import jmine.tec.aom.domain.EnumProperty;
import jmine.tec.aom.domain.PropertyType;
import jmine.tec.aom.domain.impl.BasePropertyTypes;
import jmine.tec.di.annotation.Injected;
import jmine.tec.services.api.export.ReferenceMap;
import jmine.tec.services.io.ServiceBean;

/**
 * Abstract service for {@link EnumProperty}
 * 
 * @author jrenaut
 */
public abstract class AbstractEnumPropertyService extends AbstractPropertyService<EnumProperty> {

    private PropertyTypeDAO ptDAO;

    /**
     * @return the fully qualified name of the enum class to be used
     */
    protected abstract String getEnumClass();

    /**
     * {@inheritDoc}
     */
    @Override
    protected PropertyType getPropertyType() {
        return this.ptDAO.findBySystemIdentifier(BasePropertyTypes.ENUM);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Class<EnumProperty> getPropertyClass() {
        return EnumProperty.class;
    }

    /**
     * @param ptDAO the ptDAO to set
     */
    @Injected
    public void setPtDAO(PropertyTypeDAO ptDAO) {
        this.ptDAO = ptDAO;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void executeSpecific(EnumProperty property) {
        super.executeSpecific(property);
        property.setFullyQualifiedName(this.getEnumClass());
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void fillSpecificServiceBean(ServiceBean bean, ReferenceMap referenceMap, EnumProperty entity) {
    }

}
